Repository navigation
fix(elements): degrade gracefully on empty produce/consume link attribute - #53
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Produced/consumed tag with an empty (0-length) link attribute aborts the whole export
Symptom
raised from
_legacy_linked_data, aborting the entire export for the sakeof one tag.
Root cause
TagBuilder.build()decides a tag isProduced/Consumedbased on0x6B in extended_records(the produced/consumed link attribute). On areal project file, this attribute is present but holds a genuinely
0-length value —
extended_records.get(0x6B, b"")returnsb""— insteadof the 4-byte linked
object_idit's supposed to hold._legacy_linked_datacorrectly detects this (
len(link) < 4) and raises, but the caller had nofallback: the whole file's export dies over one tag's connection metadata.
Fix
Wrap the
_legacy_produce_info/_legacy_consume_infocalls in atry/except ValueError. On failure, log a warning naming the tag and fallback to exporting it as a plain
Basetag (no produce/consume info)instead of failing the whole project's export. This mirrors the "degrade
gracefully, don't lose the whole file over one bad record" approach already
used elsewhere in this codebase (e.g.
DataTypeBuilder.build()'s existingexcept Exception: return DataType(...)fallback).Suggested validation
A tag with
0x6Bpresent but 0-length (or otherwise too short to hold a4-byte
object_id) should now export asBasewith a logged warning,rather than aborting the file.
🤖 Generated with Claude Code